import org.springframework.util.Base64Utils;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.*;
import java.util.zip.GZIPOutputStream;

public class wy {
    public static void main(String[] args) {
        List<List<String>> l=new ArrayList<>();//保存顺序
        l.add(Arrays.asList(new String[]{"2021","语文","55"}));
        l.add(Arrays.asList(new String[]{"2020","英语","55"}));
        l.add(Arrays.asList(new String[]{"2021","数学","55"}));
        l.add(Arrays.asList(new String[]{"2021","英语","55"}));
        l.add(Arrays.asList(new String[]{"2020","数学","55"}));
        l.add(Arrays.asList(new String[]{"2020","语文","55"}));
        ww(l);
    }

    private static void ww( List<List<String>> lss) {
        List<String> sx=new ArrayList<>();//保存顺序
        List<List<String>> ls=new ArrayList<>();//保存顺序
        for(List<String> l:lss){
            int w=-1;
            for(int i=0;i<sx.size();i++){
                if(l.get(0).equals(sx.get(i))){
                    w=i;
                }
            }
            if(w==-1){
                sx.add(l.get(0));
                w=sx.size()-1;
            }

        }

    }


    private static void qwq() {
        String s="cbacdcbc";
        int len = s.length();
        int[] s1 = new int[32];//只有小写字母
        for(int i=0;i<len;i++){
            s1[s.charAt(i)&31]++;
        }
        StringBuilder sc=new StringBuilder();
        char a;
        int k=-1;
        int k2=-1;
        for (int i = 0; i < len; i++) {
            if(s1[s.charAt(i)&31]==1){

                while(k<i) {
                    a='z'+1;
                    for (int j = k+1; j <= i; j++) {
                        if (s.charAt(i) < a) {
                            a = s.charAt(j);
                            k=j;
                        }
                    }
                    sc.append(a);
                    s1[a&31]=-1;
                    for (int j = k2+1; j < k; j++) {
                        s1[s.charAt(j)&31]--;
                    }
                    k2=k;
                }
//                sc.append(s.charAt(i));
            }
        }
        System.out.println(sc.toString());
    }

    private static void qq() {
        //        final String a = "abcdefghigklmnopqrstuvwxyz";
//        for (int i = 0; i < a.length(); i++) {
//            System.out.println(a.charAt(i)&31);
//        }
        char s='\u0639';
        String ss="545\0";
        System.out.println(ss);

        int a=15;
        System.out.println(a>>1);
        System.out.println(a>>1);
        System.out.println(a>>1);
    }

    private  void qq(String S) {
        System.out.println(1);
    }

    private  void qq(Object S) {
        System.out.println(2);
    }

    private static void 加密解密() {
        String number="18737945033";
        int a = 0b11111111111111111100000010000000;
        byte b = (byte) a;
        System.out.println(b);

        String afternumber=encodePhoneNumber(number);

        System.out.println("加密后"+afternumber);

        String basenumber=decodePhoneNumber(afternumber);
        System.out.println(basenumber);
    }

    public static String encodePhoneNumber(String number){
        if(number!=null&&number. length() == 11 && number.replaceAll("[0-9]" ,"").length() == 0){
            int encnum =Integer.parseInt(number.substring(2));
            int prefix = (number.charAt(1)-'2')/2;//'3'=>0, '5'=>1,'[67]'=>2, '8'=>3encnum |=(prefix <<= 30);
            System.out.println(encnum);
            encnum |= (prefix << 30);
            System.out.println(encnum);
            final byte[] raw=new byte[4];
            raw[0] =(byte)(encnum >>>24);
            raw[1]  =(byte)(encnum >>>16);
            raw[2] =(byte)(encnum >>>8);
            raw[3]=(byte) encnum;
            System.out.println(raw[0]+"  "+raw[1]+"  "+raw[2]+"  "+raw[3]);
            return number.substring(0,2)+ Base64Utils.encodeToUrlSafeString(raw);}

        else {
            return number;
        }
    }

    public static String decodePhoneNumber(String afternumber){
        String q = afternumber.substring(0,2);
        String h = afternumber.substring(2);
        byte[]raw = Base64Utils.decodeFromUrlSafeString(h);
        int encnum= (raw[3]&0xFF)+((raw[2]&0xFF)<<(8))+((raw[1]&0xFF)<<(16))+((raw[0]&0xFF)<<(24));
        int prefix = (afternumber.charAt(1)-'2')/2;
        prefix=prefix<<30;
        encnum&=~prefix;

        return q+encnum;
    }

    private static String sort(String s) {

        int[] ints = new int['z'-'A'+1];
        for (char c:s.toCharArray()) {
            int k=c-'A';
           ints[k]++;
        }
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < 52; i++) {
            int w=0;
            for(int j=0;j<'z'-'A'+1;j++){
                if(ints[j]!=0){
                    if(ints[j]>ints[w]){
                        w=j;
                    }
                }
            }
            for (int j = 0; j < ints[w]; j++) {
                sb.append((char) ('A'+w));
            }
            ints[w]=0;
        }
        return sb.toString();
    }



}